
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Customers</title>
    </head>
    <body>
        <c:import url="header.jsp"/>
        <table border="1" cellpadding="5" style="border-collapse: collapse; border: 1px solid lightgray;">
            <tr>
                <td style="width: 100px; background: silver">ID</td>
                <td style="width: 200px; background: silver">Name</td>
                <td style="width: 100px; background: silver">Description</td>
                <td style="width: 50px; background: silver"></td>
            </tr>
            <x:parse xml="${sessionScope.customers}" var="customers"/>
            <x:forEach select="$customers/customers/customer" var="item">
                <tr>
                    <td><x:out select="$item/@id"/></td>
                    <td><a href="CustomerServlet?type=update&id=<x:out select="$item/@id"/>"><x:out select="$item/@name"/></a></td>
                    <td><x:out select="$item/@description"/></td>
                    <td><a href="ControllerServlet?type=deleteCustomer&id=<x:out select="$item/@id"/>">delete</a></td>
                </tr>
            </x:forEach>
        </table>
        <button onclick="location.href='CustomerServlet?type=create'">Create</button>
    </body>
</html>
